package eu.jk.base.struct;

public class CircleLinkList<T>{
	LinkNode<T> hook=null;
	
	public CircleLinkList(int size){
		LinkNode<T> tmp=null;
		tmp=hook=new LinkNode<T>(null,hook);
		for(int i=1;i<size;i++){
			hook=new LinkNode<T>(null,hook);
		}
		tmp.setPtr(tmp);
	}
	
	public CircleLinkList(int size,T data){
		LinkNode<T> tmp=null;
		tmp=hook=new LinkNode<T>(data,hook);
		for(int i=1;i<size;i++){
			hook=new LinkNode<T>(data,hook);
		}
		tmp.setPtr(tmp);
	}
	
	public T MoveOn(){
		T data=hook.getDate();
		hook=hook.getPtr();
		return data;
	}
	
	public T update(T date){
		T odata=hook.getDate();
		hook.setDate(date);
		hook=hook.getPtr();
		return odata;
	}
}
